<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<base href="<%=basePath%>">

<html>

<head>
    <meta charset="utf-8">
    <title>
        阳光成单系统
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="System/css/x-admin.css" media="all">
</head>

<body>
<div class="x-body">
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label for="L_title" class="layui-form-label">
                车牌号
            </label>
            <div class="layui-input-block">
                <input type="text" id="L_title" name="carNumber" required lay-verify="departmentName"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_title" class="layui-form-label">
                司机
            </label>
            <div class="layui-input-block">
                <input type="text" id="" name="employeesId" required lay-verify="departmentName"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-filter="add" lay-submit>
                立即添加
            </button>
        </div>
    </form>
</div>
<script src="System/lib/layui/layui.js" charset="utf-8">
</script>
<script src="System/js/x-layui.js" charset="utf-8">
</script>
<script>
    layui.use(['form','layer','layedit'], function(){
        $ = layui.jquery;
        var form = layui.form()
            ,layer = layui.layer
            ,layedit = layui.layedit;
        layedit.set({
            uploadImage: {
                url: "./upimg.json" //接口url
                ,type: 'post' //默认post
            }
        });

        //创建一个编辑器
        editIndex = layedit.build('L_content');
        //添加部分信息
        form.on('submit(add)', function (data) {
            alert(data);
            console.log(data);
            var carNumber=data.field.carNumber;
            var employeesId=data.field.employeesId;
            location.href="department/insertDept?departmentMark="+departmentMark+"&departmentName="+departmentName;
            //发异步，把数据提交给java
           // 获得frame索引
            var index = parent.layer.getFrameIndex(window.name);
           parent.layer.close(index);//关闭当前页
            layer.msg('添加成功!',{time:1000});
            return false;
        });
    });
</script>

</body>

</html>

